package com.qdu.service.impl;

import com.qdu.model.Employee;
import java.util.List;
import com.qdu.dao.EmployeeDao;
import com.qdu.dao.impl.EmployeeDaoImpl;
import com.qdu.service.EmployeeService;

/**
 * EmployeeService接口的实现类，包含了员工相关业务功能的实现
 *
 * @author Anna
 */
public class EmployeeServiceImpl implements EmployeeService {

    EmployeeDao employeeDao = new EmployeeDaoImpl();


    @Override
    public Employee findEmployeeById(String empId) {
        return employeeDao.getOneById(empId);
    }

    @Override
    public int addNewEmployee(Employee emp) {
        return employeeDao.insert(emp);
    }

    @Override
    public int modifyEmployeeInfo(Employee emp) {
        return employeeDao.update(emp);
    }
    
    @Override
    public int modifyEmployeePhoto(String empId, String photo) {
        return employeeDao.updatePhoto(empId, photo);
    }

    @Override
    public int deleteEmployee(String empId) {
        return employeeDao.deleteById(empId);
    }

    @Override
    public List<Employee> findAllEmployees() {
        return employeeDao.getAll();
    }

    @Override
    public int addNewEmployee(String eid, String ephoto) {
        return employeeDao.insert(eid, ephoto);
    }
}
